package moniCA::DBH::Oracle;

#################################################################
# $LastChangedDate: 2013-11-25 15:03:06 +0000 (Mon, 25 Nov 2013) $
# $LastChangedRevision: 22 $
# $LastChangedBy: aswod_83@gmx.net $
#################################################################
use strict;
use base qw /moniCA/;
use DBI;
use DBD::Oracle qw(:ora_session_modes);
use Data::Dumper;
use XML::Simple;

#-------------------------------------------------------------------------------
sub ConnectDB {

#-------------------------------------------------------------------------------
# Description:
# Input Parms:
# Output Parms:
#-------------------------------------------------------------------------------
    my $self = shift;
    my $dbc  = shift;
    DBI->trace(1) if ( $self->{CNF}->{LogLevel} eq 'TRACE' );
    my $db = DBI->connect(
        $dbc->{ConnectString}, $dbc->{dbuser},
        $dbc->{dbpw}, { RaiseError => 1 }
    );
    $self->{DBH} = $db;
    return $self;
}

#-------------------------------------------------------------------------------
sub DisconnectDB {

#-------------------------------------------------------------------------------
# Description:
# Input Parms:
# Output Parms:
#-------------------------------------------------------------------------------
    my $self   = shift;
    my $logger = $self->GetLogger();
    $self->{DBH}->disconnect() || $logger->warn("$self->{DBH}->errstr");
    return $self;
}

1;
